package com.ibuonline.b2b.entity;

import java.io.Serializable;

public class CmsInfo implements Serializable {

	private static final long serialVersionUID = -9029701621920356656L;

	//fields
	private java.lang.Integer id;
	private java.lang.Integer infoType;
	private java.lang.Integer infoCat;
	private java.lang.String title;
	private java.lang.String content;
	private java.lang.Boolean top;
	private java.sql.Timestamp publishTime;
	private java.sql.Timestamp lastupdate;

	//default constructor
	public CmsInfo() {
	}

	//getter
	public java.lang.Integer getId() {
		return id;
	}
	public java.lang.Integer getInfoType() {
		return infoType;
	}
	public java.lang.Integer getInfoCat() {
		return infoCat;
	}
	public java.lang.String getTitle() {
		return title;
	}
	public java.lang.String getContent() {
		return content;
	}
	public java.lang.Boolean isTop() {
		return top;
	}
	public java.sql.Timestamp getPublishTime() {
		return publishTime;
	}
	public java.sql.Timestamp getLastupdate() {
		return lastupdate;
	}

	//setter
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public void setInfoType(java.lang.Integer infoType) {
		this.infoType = infoType;
	}
	public void setInfoCat(java.lang.Integer infoCat) {
		this.infoCat = infoCat;
	}
	public void setTitle(java.lang.String title) {
		this.title = title;
	}
	public void setContent(java.lang.String content) {
		this.content = content;
	}
	public void setTop(java.lang.Boolean top) {
		this.top = top;
	}
	public void setPublishTime(java.sql.Timestamp publishTime) {
		this.publishTime = publishTime;
	}
	public void setLastupdate(java.sql.Timestamp lastupdate) {
		this.lastupdate = lastupdate;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof CmsInfo))
			return false;

		final CmsInfo cmsInfo = (CmsInfo)other;
		if (!this.id.equals(cmsInfo.getId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(id).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("CmsInfo[")
			.append("id=").append(id).append(", ")
			.append("infoType=").append(infoType).append(", ")
			.append("infoCat=").append(infoCat).append(", ")
			.append("title=").append(title).append(", ")
			.append("content=").append(content).append(", ")
			.append("top=").append(top).append(", ")
			.append("publishTime=").append(publishTime).append(", ")
			.append("lastupdate=").append(lastupdate).append("]").toString();
	}
	
	///###################################3
	public String getTitleName() {
		if (title != null && title.length() > 25) {
			return title.substring(0, 25) + "...";
		} else {
			return title;
		}
	}
	
}